# 设置控制台代码页和编码为UTF-8
chcp 65001 > $null
$env:PYTHONIOENCODING = "utf-8"
$env:NODE_OPTIONS = "--experimental-modules"
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::InputEncoding = [System.Text.Encoding]::UTF8

# 设置PowerShell的默认编码
$PSDefaultParameterValues['*:Encoding'] = 'utf8'

Write-Host "Starting Cloud Bucket Uploader..." -ForegroundColor Green
Set-Location $PSScriptRoot
try {
    npx electron app\main.js
} catch {
    Write-Host "Error: Failed to start the application." -ForegroundColor Red
    Write-Host "Please make sure Node.js and npm are installed." -ForegroundColor Yellow
    Read-Host "Press Enter to continue"
}